<!--
 * @Author: 小野岚 2369037721@qq.com
 * @Date: 2022-11-07 00:38:23
 * @LastEditors: @xiaoye-lan 2369037721@qq.com
 * @LastEditTime: 2022-11-10 17:19:31
 * @FilePath: \vue-cq\src\views\Layout.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="page">
    <!-- 头部 -->
    <cq-header :isIndex="isIndex" />
    <router-view />
    <!-- 尾部 -->
    <cq-footer />
  </div>
</template>
<script>
import CqHeader from '@/components/cq-header'
import CqFooter from '@/components/cq-footer'
export default {
  name: 'layout-page',
  components: {
    CqHeader,
    CqFooter
  },
  data() {
    return {
      isIndex: false
    }
  },
  beforeRouteEnter(to, from, next) {
    console.log('to1: ', to)
    next((vm) => {
      vm.isIndex = to.name === 'home'
    })
  },
  beforeRouteUpdate(to, from, next) {
    this.isIndex = to.name === 'home'
    next()
  }
}
</script>
<style lang="scss" scoped>
</style>
